from base_page import BasePage
from selenium.webdriver.common.by import By


class BaiduNewsPage(BasePage):
    __url = "https://news.baidu.com/"
    __input = (By.ID,'ww')
    __click = (By.CSS_SELECTOR,'#s_btn_wr')

    def opennewsPage(self):
        self.driver.get(self.__url)

    def search(self,news):
        self.find_element(*self.__input).send_keys(news)

    def clickBth(self):
        self.find_element(*self.__click).click()

    def search_news(self, news):
        self.opennewsPage()
        self.search(news)
        self.clickBth()
